-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return an HTTP 429 when we're over capacity #232
Conversation
Codecov Report
@@ Coverage Diff @@
## main #232 +/- ##
===================================================
+ Coverage 51.85364% 52.07156% +0.21792%
===================================================
Files 32 33 +1
Lines 2077 2124 +47
===================================================
+ Hits 1077 1106 +29
- Misses 894 912 +18
Partials 106 106
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
coordinator.StartUploadJob(pipeline.UploadJobPayload{ | ||
RequestID: fmt.Sprintf("request-%d", x), | ||
}) | ||
} | ||
|
||
// Set up the HTTP handler | ||
handler := HasCapacity(coordinator, next) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I wonder how racy this is since the jobs run in background and the stub handlers return immediately. Does it pass consistently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think because the stub handlers never trigger the Mist callbacks right? So the jobs stay in flight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure actually. I think they may return an error which finishes the job and sends a callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the real handlers with mock clients instead
Currently very crude, but protects us from being DOSed.
Future iterations will probably be